Method: Rugged::Settings.[]=
- Defined in:
- ext/rugged/rugged_settings.c
permalink .[]=(option) ⇒ Object
Sets a libgit2 library option.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'ext/rugged/rugged_settings.c', line 51
static VALUE rb_git_set_option(VALUE self, VALUE option, VALUE value)
{
const char *opt;
Check_Type(option, T_STRING);
opt = StringValueCStr(option);
if (strcmp(opt, "mwindow_size") == 0) {
size_t val;
Check_Type(value, T_FIXNUM);
val = NUM2SIZET(value);
git_libgit2_opts(GIT_OPT_SET_MWINDOW_SIZE, val);
}
else if (strcmp(opt, "mwindow_mapped_limit") == 0) {
size_t val;
Check_Type(value, T_FIXNUM);
val = NUM2SIZET(value);
git_libgit2_opts(GIT_OPT_SET_MWINDOW_MAPPED_LIMIT, val);
}
else if (strcmp(opt, "search_path_global") == 0) {
set_search_path(GIT_CONFIG_LEVEL_GLOBAL, value);
}
else if (strcmp(opt, "search_path_xdg") == 0) {
set_search_path(GIT_CONFIG_LEVEL_XDG, value);
}
else if (strcmp(opt, "search_path_system") == 0) {
set_search_path(GIT_CONFIG_LEVEL_SYSTEM, value);
}
else if (strcmp(opt, "strict_object_creation") == 0) {
int strict = RTEST(value) ? 1 : 0;
git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, strict);
}
else if (strcmp(opt, "fsync_gitdir") == 0) {
int fsync = RTEST(value) ? 1 : 0;
git_libgit2_opts(GIT_OPT_ENABLE_FSYNC_GITDIR, fsync);
}
else {
rb_raise(rb_eArgError, "Unknown option specified");
}
return Qnil;
}
|